#include <cstdio>
#include <algorithm>
#define F(i, a, b) for (int i=a; i<=b; i++)

using namespace std;

typedef long long ll;
const int maxn=1000000;
struct List {
    ll v;
    List *l;

    List(ll x=0) {v=x;}
};

int n, m, ind[maxn+1], to[2*maxn-1], link[2*maxn-1], len[maxn+1];
List *l[maxn+1], *s[maxn+1];

List* merge(List *a, List *b) {
    if (!a) return b;
    for (List *i=a, *j=b; i && j; i=i->l, j=j->l) {
        i->v += j->v;
        if (j->l && !i->l) {
            i->l = j->l;
            j->l = 0;
        }
    }
    return a;
}

void addSide(int u, int v) {
    m++;
    to[m] = v;
    link[m] = ind[u];
    ind[u] = m;
}

ll solve(int o, int fa) {
    ll ret=0;
    len[o] = n+1;
    l[o] = new List(1);
    for (int i=ind[o]; i; i=link[i]) {
        int x=to[i];
        if (x!=fa) {
            ret += solve(x, o);

            for (List *p=l[x], *q=s[o]; p && q; p=p->l, q=q->l) {
                ret += p->v*q->v;
            }
            for (List *p=s[x], *q=l[o]; p && q; p=p->l, q=q->l) {
                ret += p->v*q->v;
            }

            if (!s[o] && l[x] && l[o]->l) s[o] = new List();
            for (List *p=l[x], *q=l[o]->l, *t=s[o]; p && q; p=p->l, q=q->l) {
                t->v += p->v*q->v;
                if (!t->l) t->l = new List();
                t = t->l;
            }
            if (s[x]) s[o] = merge(s[o], s[x]->l);
            l[o]->l = merge(l[o]->l, l[x]);
        }
    }

    return ret;
}

int main() {
    freopen("zh.in", "r", stdin);
    freopen("zh.out", "w", stdout);

    scanf("%d", &n);
    F(i, 1, n-1) {
        int x, y;
        scanf("%d %d", &x, &y);
        addSide(x, y);
        addSide(y, x);
    }

    printf("%lld\n", solve(1, 0));

    fclose(stdin);
    fclose(stdout);
    return 0;
}
